<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Vue动画和velocity.js的结合</title>
    <script src="vue.js"></script>
</head>
<body>
<div id="app">
    <transition
            @before-enter="handleBeforeEnter"
            @enter = "handleEnter"
            @after-enter="handAfterEnter"
    >
        <div v-if="show">Hello world</div>
    </transition>
    <button @click="toggle">toggle</button>
</div>
<script>
    var vm = new Vue({
        el:"#app",
        data:{
            show:true
        },
        methods:{
            toggle:function () {
                this.show = !this.show
            },
            handleBeforeEnter:function (el) {
                el.style.color = 'red'
            },
            handleEnter:function (el, done) {
                setTimeout(() => {
                    el.style.color = 'green';
                },1500);
                setTimeout(() =>{
                    done();
                },3000);
            },
            handAfterEnter:function (el) {
                el.style.color = '#333';
            }
        }
    });
</script>
</body>
</html>